WavySlider

fun WavySlider(value: Float, onValueChange: (Float) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, onValueChangeFinished: () -> Unit? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, colors: SliderColors = SliderDefaults.colors(), waveLength: Dp = defaultWaveSize, waveHeight: Dp = defaultWaveSize, waveThickness: Dp = defaultTrackThickness, trackThickness: Dp? = defaultTrackThickness, animationDirection: WaveAnimationDirection = WaveAnimationDirection.UNSPECIFIED, shouldFlatten: Boolean = false)

A wavy slider much like the Material Design 2 slider.

By setting waveHeight to 0.dp it becomes just a regular Material Slider.

This component can also be used as a progress bar.

Note that range sliders do not make sense for the wavy slider. So, there is no RangeWavySlider counterpart.

Parameters

value

current value of the WavySlider

onValueChange

lambda in which value should be updated

modifier

modifiers for the WavySlider layout

enabled

whether or not component is enabled and can be interacted with or not

onValueChangeFinished

lambda to be invoked when value change has ended. This callback shouldn't be used to update the wavy slider value (use onValueChange for that), but rather to know when the user has completed selecting a new value by ending a drag or a click.

interactionSource

the MutableInteractionSource representing the stream of Interactions for this WavySlider. You can create and pass in your own remembered MutableInteractionSource if you want to observe Interactions and customize the appearance / behavior of this WavySlider in different Interactions.

colors

SliderColors that will be used to determine the color of the WavySlider parts in different state. See SliderDefaults.colors to customize.

waveLength

the distance over which the wave's shape repeats (must be 0.dp)

waveHeight

the total height of the wave (from crest to trough) (in other words, amplitude * 2)

waveThickness

the thickness of the active line (whether animated or not)

trackThickness

the thickness of the inactive line

animationDirection

the direction of wave movement which is, by default, from right to left for LTR layouts and from left to right for RTL layouts. Setting to WaveAnimationDirection.UNSPECIFIED also does the same thing

shouldFlatten

whether to decrease the wave height the farther it is from the thumb